<?php
/**
 * Created by dutuwang.net
 * User: adophper
 * Date: 2018/3/29
 * Time: 9:35
 */

use common\models\UserCompany;
if (!Yii::$app->user->isGuest) {
    $userId = Yii::$app->user->getId();
    $userCompany = UserCompany::findOne(['user_id' => $userId]);
}
?>
<div class="page_top flex f_between contBox">
    <a href="/" class="logo img"><img src="/static/frontend/image/logo_2.png" /> </a>
    <div class="top_search">
        <span class="f_relative"><input type="text" onkeyup="location.href='<?=Yii::$app->urlManager->createUrl(['zhanhui/index'])?>';"><i class="iconfont">&#xe643;</i></span>
        <?php
        if (Yii::$app->user->isGuest) {
        ?>
        <a href="<?=Yii::$app->urlManager->createUrl(['member/login']) ?>" title="登录"><i class="iconfont point">&#xe614;</i></a>
        <a href="<?=Yii::$app->urlManager->createUrl(['member/register']) ?>" title="注册"><i class="iconfont point">&#xe645;</i></a>
        <?php
        }else{
        ?>
        <a href="<?=Yii::$app->urlManager->createUrl(['member/index']) ?>" title="会员中心"><i class="iconfont point">&#xe641;</i></a>
        <?php
        if (empty($userCompany)) {
        ?>
        <a href="<?=Yii::$app->urlManager->createUrl(['member/zhubanfang']) ?>" title="会展主办方">会展主办方</a>
        <i>|</i>
        <a href="<?=Yii::$app->urlManager->createUrl(['member/canzhanshang']) ?>" title="会展参展商">会展参展商</a>
        <i>|</i>
        <a href="<?=Yii::$app->urlManager->createUrl(['member/fuwushang']) ?>" title="会展服务外包">会展服务外包</a>
        <i>|</i>
        <?php
        }else {
            if ($userCompany->type == UserCompany::COMPANY_TYPE_Z){
        ?>
        <a href="<?=Yii::$app->urlManager->createUrl(['member/zhubanfang']) ?>" title="会展主办方">会展主办方</a>
        <i>|</i>
        <?php
            }elseif ($userCompany->type == UserCompany::COMPANY_TYPE_C) {
        ?>
        <a href="<?=Yii::$app->urlManager->createUrl(['member/canzhanshang']) ?>" title="会展参展商">会展参展商</a>
        <i>|</i>
        <?php
            }elseif ($userCompany->type == UserCompany::COMPANY_TYPE_F) {
        ?>
        <a href="<?=Yii::$app->urlManager->createUrl(['member/fuwushang']) ?>" title="会展服务外包">会展服务外包</a>
        <i>|</i>
        <?php
            }
        }
        ?>
        <a href="<?=Yii::$app->urlManager->createUrl(['member/logout']) ?>" title="退出"><i>退出</i></a>
        <?php
        }
        ?>
    </div>
</div>
